VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MsComCtl.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmAPRFP 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   8475
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   9765
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   8475
   ScaleWidth      =   9765
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   0
      Top             =   8190
      Width           =   9765
      _ExtentX        =   17224
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   3997
            MinWidth        =   2
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin ITGControls.ITGTab SSTab1 
      Height          =   2355
      Left            =   0
      TabIndex        =   11
      Top             =   0
      Width           =   9645
      _ExtentX        =   17013
      _ExtentY        =   4154
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      InActiveTabForeColor=   0
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483630
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   2040
         Left            =   -75000
         TabIndex        =   17
         Top             =   315
         Width           =   9645
         _ExtentX        =   17013
         _ExtentY        =   3598
         _Version        =   393216
         HeadLines       =   1
         RowHeight       =   15
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   6
         BeginProperty Column00 
            DataField       =   "cTranNo"
            Caption         =   "RFP No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "dDate"
            Caption         =   "Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cCode"
            Caption         =   "Code"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "cName"
            Caption         =   "Name"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "cPayfor"
            Caption         =   "Pay for"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "dDateNeeded"
            Caption         =   "Date Needed"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               ColumnWidth     =   1170.142
            EndProperty
            BeginProperty Column01 
               ColumnWidth     =   1094.74
            EndProperty
            BeginProperty Column02 
               ColumnWidth     =   1335.118
            EndProperty
            BeginProperty Column03 
               ColumnWidth     =   2580.095
            EndProperty
            BeginProperty Column04 
               ColumnWidth     =   1755.213
            EndProperty
            BeginProperty Column05 
               ColumnWidth     =   1124.787
            EndProperty
         EndProperty
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   2040
         Left            =   0
         Top             =   315
         Width           =   9645
         _ExtentX        =   17013
         _ExtentY        =   3598
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Header Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.ComboBox cboType 
            Height          =   315
            ItemData        =   "frmAPRFP.frx":0000
            Left            =   5460
            List            =   "frmAPRFP.frx":000A
            Sorted          =   -1  'True
            Style           =   2  'Dropdown List
            TabIndex        =   2
            Top             =   570
            Width           =   1515
         End
         Begin VB.CommandButton cmdCode 
            Height          =   300
            Left            =   2385
            Picture         =   "frmAPRFP.frx":0022
            Style           =   1  'Graphical
            TabIndex        =   5
            Top             =   900
            Width           =   315
         End
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   3060
            Top             =   465
         End
         Begin ITGControls.ITGDateBox dtpDate 
            Height          =   285
            Left            =   7860
            TabIndex        =   3
            Top             =   585
            Width           =   1320
            _ExtentX        =   2328
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtType 
            Height          =   285
            Left            =   5655
            TabIndex        =   12
            Top             =   585
            Visible         =   0   'False
            Width           =   1215
            _ExtentX        =   2037
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   ""
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1155
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtTranNo 
            Height          =   285
            Left            =   135
            TabIndex        =   1
            Top             =   585
            Width           =   2580
            _ExtentX        =   4339
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "RFP No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1000
            TextBoxWidth    =   1520
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtCode 
            Height          =   285
            Left            =   135
            TabIndex        =   4
            Top             =   915
            Width           =   2220
            _ExtentX        =   3704
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Supplier"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1000
            TextBoxWidth    =   1160
            Required        =   -1  'True
            LinkForeColor   =   16711680
         End
         Begin ITGControls.ITGDateBox dtpDateNeeded 
            Height          =   285
            Left            =   4575
            TabIndex        =   9
            Top             =   1545
            Width           =   1305
            _ExtentX        =   2302
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtPayfor 
            Height          =   285
            Left            =   135
            TabIndex        =   7
            Top             =   1230
            Width           =   9045
            _ExtentX        =   15743
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Payment For"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1000
            TextBoxWidth    =   7985
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtName 
            Height          =   285
            Left            =   2700
            TabIndex        =   6
            Top             =   915
            Width           =   6480
            _ExtentX        =   11324
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   6420
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGDateBox dtpDatedCheck 
            Height          =   285
            Left            =   7830
            TabIndex        =   10
            Top             =   1545
            Width           =   1350
            _ExtentX        =   2381
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtPCCode 
            Height          =   285
            Left            =   135
            TabIndex        =   8
            Top             =   1545
            Width           =   2580
            _ExtentX        =   4339
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Profit Center"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1000
            TextBoxWidth    =   1520
            Required        =   -1  'True
         End
         Begin VB.Label Label4 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Check to be date"
            Height          =   195
            Left            =   6435
            TabIndex        =   16
            Top             =   1545
            Width           =   1230
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date Needed"
            Height          =   195
            Left            =   3480
            TabIndex        =   15
            Top             =   1545
            Width           =   945
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date"
            Height          =   195
            Left            =   7365
            TabIndex        =   14
            Top             =   585
            Width           =   345
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Type"
            Height          =   195
            Left            =   4965
            TabIndex        =   13
            Top             =   585
            Width           =   360
         End
      End
   End
   Begin ITGControls.ComunionFrames ComunionFrames3 
      Height          =   1620
      Left            =   0
      Top             =   6045
      Width           =   9645
      _ExtentX        =   17013
      _ExtentY        =   2858
      FrameColor      =   4210752
      BackColor       =   16243138
      FillColor       =   16243138
      RoundedCorner   =   0   'False
      Caption         =   "Remarks"
      Alignment       =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ThemeColor      =   5
      ColorFrom       =   16243138
      ColorTo         =   16250865
      Begin ITGControls.ITGTextBox ITGcRemarks 
         Height          =   285
         Left            =   1155
         TabIndex        =   18
         Top             =   1050
         Visible         =   0   'False
         Width           =   3855
         _ExtentX        =   6588
         _ExtentY        =   503
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Label           =   "ITGcRemarks"
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         TextBoxWidth    =   2295
      End
      Begin RichTextLib.RichTextBox txtRemarks 
         Height          =   1200
         Left            =   0
         TabIndex        =   19
         Tag             =   "C"
         Top             =   420
         Width           =   9645
         _ExtentX        =   17013
         _ExtentY        =   2117
         _Version        =   393217
         ScrollBars      =   3
         MaxLength       =   1000
         Appearance      =   0
         TextRTF         =   $"frmAPRFP.frx":016C
      End
   End
   Begin ITGControls.ComunionFrames ComunionFrames2 
      Height          =   3720
      Left            =   0
      Top             =   2340
      Width           =   9645
      _ExtentX        =   17013
      _ExtentY        =   6562
      FrameColor      =   4210752
      BackColor       =   16243138
      FillColor       =   16243138
      RoundedCorner   =   0   'False
      Caption         =   "Voucher Details"
      Alignment       =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ThemeColor      =   5
      ColorFrom       =   16243138
      ColorTo         =   16250865
      Begin ITGControls.ITGTab SSTab2 
         Height          =   3300
         Left            =   0
         TabIndex        =   20
         Top             =   420
         Width           =   9630
         _ExtentX        =   16986
         _ExtentY        =   5821
         TabCount        =   4
         TabCaption(0)   =   "     Opex     "
         TabContCtrlCnt(0)=   2
         Tab(0)ContCtrlCap(1)=   "dtgOpex"
         Tab(0)ContCtrlCap(2)=   "cboRFP"
         TabCaption(1)   =   "     Trade     "
         TabContCtrlCnt(1)=   1
         Tab(1)ContCtrlCap(1)=   "dtgTrade"
         TabCaption(2)   =   "     Non-Trade     "
         TabContCtrlCnt(2)=   1
         Tab(2)ContCtrlCap(1)=   "dtgNonTrade"
         TabCaption(3)   =   "     TPC     "
         TabContCtrlCnt(3)=   1
         Tab(3)ContCtrlCap(1)=   "dtgTPC"
         ActiveTab       =   1
         TabTheme        =   2
         ActiveTabBackStartColor=   16250865
         ActiveTabBackEndColor=   16243138
         InActiveTabBackStartColor=   16250865
         InActiveTabBackEndColor=   16243138
         BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         OuterBorderColor=   4210752
         TopLeftInnerBorderColor=   4210752
         BottomRightInnerBorderColor=   4210752
         DisabledTabBackColor=   16243138
         DisabledTabForeColor=   -2147483630
         Begin MSDataGridLib.DataGrid dtgOpex 
            Height          =   2985
            Left            =   -75000
            TabIndex        =   25
            Top             =   315
            Width           =   9645
            _ExtentX        =   17013
            _ExtentY        =   5265
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            Appearance      =   0
            BackColor       =   16777215
            ForeColor       =   -2147483641
            HeadLines       =   1
            RowHeight       =   15
            TabAction       =   2
            WrapCellPointer =   -1  'True
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   6
            BeginProperty Column00 
               DataField       =   "cType"
               Caption         =   "Type"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cAcctNo"
               Caption         =   "Account No."
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "cTitle"
               Caption         =   "Title"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "cDesc"
               Caption         =   "Description"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "nDebit"
               Caption         =   "Debit"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column05 
               DataField       =   "nCredit"
               Caption         =   "Credit"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Button          =   -1  'True
                  Locked          =   -1  'True
                  ColumnWidth     =   870.236
               EndProperty
               BeginProperty Column01 
                  Button          =   -1  'True
                  ColumnWidth     =   1349.858
               EndProperty
               BeginProperty Column02 
                  Locked          =   -1  'True
                  ColumnWidth     =   1920.189
               EndProperty
               BeginProperty Column03 
                  ColumnWidth     =   3390.236
               EndProperty
               BeginProperty Column04 
                  Alignment       =   1
                  ColumnWidth     =   1574.929
               EndProperty
               BeginProperty Column05 
                  Alignment       =   1
               EndProperty
            EndProperty
         End
         Begin VB.ComboBox cboRFP 
            Height          =   315
            ItemData        =   "frmAPRFP.frx":01E7
            Left            =   -74580
            List            =   "frmAPRFP.frx":01F1
            Style           =   2  'Dropdown List
            TabIndex        =   24
            Top             =   2385
            Visible         =   0   'False
            Width           =   915
         End
         Begin MSDataGridLib.DataGrid dtgTrade 
            Height          =   2985
            Left            =   0
            TabIndex        =   23
            Top             =   315
            Width           =   9660
            _ExtentX        =   17039
            _ExtentY        =   5265
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            Appearance      =   0
            HeadLines       =   1
            RowHeight       =   15
            TabAction       =   1
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   7
            BeginProperty Column00 
               DataField       =   "cInvNo"
               Caption         =   "Purchase Invoice"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "dDate"
               Caption         =   "Date"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "M/dd/yy"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   3
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "nAmount"
               Caption         =   "Amount"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "nApplied"
               Caption         =   "Applied Amount"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "cSuppInvNo"
               Caption         =   "Supplier Invoice No."
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column05 
               DataField       =   "dInvDate"
               Caption         =   "Invoice Date"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column06 
               DataField       =   "cTerm"
               Caption         =   "Term"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Button          =   -1  'True
                  ColumnWidth     =   2220.094
               EndProperty
               BeginProperty Column01 
                  Alignment       =   2
                  Locked          =   -1  'True
                  ColumnWidth     =   1560.189
               EndProperty
               BeginProperty Column02 
                  Alignment       =   1
                  Locked          =   -1  'True
                  ColumnWidth     =   2250.142
               EndProperty
               BeginProperty Column03 
                  Alignment       =   1
                  ColumnWidth     =   2250.142
               EndProperty
               BeginProperty Column04 
               EndProperty
               BeginProperty Column05 
               EndProperty
               BeginProperty Column06 
               EndProperty
            EndProperty
         End
         Begin MSDataGridLib.DataGrid dtgNonTrade 
            Height          =   2985
            Left            =   -75000
            TabIndex        =   22
            Top             =   315
            Width           =   9645
            _ExtentX        =   17013
            _ExtentY        =   5265
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            Appearance      =   0
            HeadLines       =   1
            RowHeight       =   15
            TabAction       =   2
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   7
            BeginProperty Column00 
               DataField       =   "cPayableID"
               Caption         =   "Payable"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cDesc"
               Caption         =   "Description"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "dDate"
               Caption         =   "Date"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "M/d/yyyy"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   3
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "nAmount"
               Caption         =   "Amount"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "nApplied"
               Caption         =   "Applied Amount"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column05 
               DataField       =   "nEWT"
               Caption         =   "EWT"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column06 
               DataField       =   "nEVAT"
               Caption         =   "EVAT"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Button          =   -1  'True
                  ColumnWidth     =   1184.882
               EndProperty
               BeginProperty Column01 
                  Locked          =   -1  'True
                  ColumnWidth     =   2729.764
               EndProperty
               BeginProperty Column02 
                  Alignment       =   2
                  Locked          =   -1  'True
                  ColumnWidth     =   1170.142
               EndProperty
               BeginProperty Column03 
                  Alignment       =   1
                  Locked          =   -1  'True
                  ColumnWidth     =   1289.764
               EndProperty
               BeginProperty Column04 
                  Alignment       =   1
                  Locked          =   -1  'True
                  ColumnWidth     =   1319.811
               EndProperty
               BeginProperty Column05 
                  Locked          =   -1  'True
                  ColumnWidth     =   1230.236
               EndProperty
               BeginProperty Column06 
                  Locked          =   -1  'True
                  ColumnWidth     =   1214.929
               EndProperty
            EndProperty
         End
         Begin MSDataGridLib.DataGrid dtgTPC 
            Height          =   2985
            Left            =   -75000
            TabIndex        =   21
            Top             =   315
            Width           =   9645
            _ExtentX        =   17013
            _ExtentY        =   5265
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            Appearance      =   0
            HeadLines       =   1
            RowHeight       =   15
            TabAction       =   2
            WrapCellPointer =   -1  'True
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   7
            BeginProperty Column00 
               DataField       =   "nIdentity"
               Caption         =   ""
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cCompanyId"
               Caption         =   ""
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "cTranNo"
               Caption         =   ""
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "cInvNo"
               Caption         =   "Invoice No."
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "dDate"
               Caption         =   "Date"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "M/dd/yy"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   3
               EndProperty
            EndProperty
            BeginProperty Column05 
               DataField       =   "nAmount"
               Caption         =   "TPC Gross"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column06 
               DataField       =   "nApplied"
               Caption         =   "Applied Amount"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Object.Visible         =   0   'False
                  ColumnWidth     =   1995.024
               EndProperty
               BeginProperty Column01 
                  Object.Visible         =   0   'False
                  ColumnWidth     =   1964.976
               EndProperty
               BeginProperty Column02 
                  Object.Visible         =   0   'False
                  ColumnWidth     =   2055.118
               EndProperty
               BeginProperty Column03 
                  Button          =   -1  'True
                  ColumnWidth     =   1814.74
               EndProperty
               BeginProperty Column04 
                  Alignment       =   2
                  Locked          =   -1  'True
                  ColumnWidth     =   1739.906
               EndProperty
               BeginProperty Column05 
                  Alignment       =   1
                  Locked          =   -1  'True
                  ColumnWidth     =   2294.929
               EndProperty
               BeginProperty Column06 
                  Alignment       =   1
                  ColumnWidth     =   2445.166
               EndProperty
            EndProperty
         End
      End
   End
End
Attribute VB_Name = "frmAPRFP"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'IT Group Inc. 2005.09.23

Option Explicit

'Object variables




Private oPrint As New clsPrinting


'Recordset variables
Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsTrade As ADODB.Recordset     'trade detail
Private rsOPEX As ADODB.Recordset    'opex detail
Private rsNonTrade As ADODB.Recordset       'non trade detail
Private rsTPC As ADODB.Recordset       'tpc detail

'ADO Connection variables

Private connHeader As ADODB.Connection
Private connTrade As ADODB.Connection
Private connOPEX As ADODB.Connection
Private connNonTrade As ADODB.Connection
Private connTPC As ADODB.Connection

Private rsInvData As ADODB.Recordset

'Form mode enumeration
Enum eRFPMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As eRFPMode

Private lSystemGenerated As Boolean
Private strNo As String

Public dtgName As String
Public sBit As String
Private vBM As Variant 'Recordset bookmark variable

'Security Acess Level variables
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Private Sub cboType_Click()
    txtType = Trim(cboType)
End Sub

Private Sub cboType_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub cboRFP_Click()
    rsOPEX!cType = Trim(cboRFP)
End Sub
    
Private Sub cboRFP_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If dtgOPEX.Col = 3 Then
            cboRFP_LostFocus
            dtgOPEX.Col = 4
            dtgOPEX.SetFocus
        End If
    ElseIf KeyCode = vbKeyEscape Then
        cboRFP.Visible = False
    End If
End Sub

Private Sub cboRFP_LostFocus()
    cboRFP.Visible = False
    If cboRFP.Text = "DBM" Then
        dtgOPEX.Columns(4).Locked = False
        dtgOPEX.Columns(5).Locked = True
        
    ElseIf cboRFP.Text = "CRM" Then
        dtgOPEX.Columns(4).Locked = True
        dtgOPEX.Columns(5).Locked = False
    End If
End Sub

Private Sub cmdCode_Click()
    If lPickListActive Then Exit Sub
    'If rsHeader!cType = "Trade" Then
    If txtType.Text = "Trade" Then
        frmITGPicker.zType = QSupplier
    Else
        frmITGPicker.zType = QSupplierNT
    End If
    frmITGPicker.Show vbModal
    'rsHeader!cCode = frmITGPicker.zCode
    txtCode.Text = frmITGPicker.zCode
    txtName = frmITGPicker.zName
    If Trim(txtName) <> "" Then
        SendKeys "{Tab}"
        SendKeys "{Tab}"
    End If
End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
    SortGrid dtgList, ColIndex, rsHeader
End Sub

Private Sub dtgNonTrade_ButtonClick(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            RepName = Trim(txtCode)
            frmAPList.mType = Payables
            frmAPList.Show vbModal
            If frmAPList.mRefPK <> "" Then
                dtgNonTrade.Columns(0).Value = frmAPList.mRefPK
                Set rs = Nothing
                Set rs = New ADODB.Recordset
                sSQL = "select * from PAYABLES where cTranNo = '" & Trim(frmAPList.mRefPK) & "' and cCompanyID = '" & COID & "'"
                rs.Open sSQL, cn, adOpenKeyset, adLockReadOnly
                With rsNonTrade
                    !cPayableID = rs!cTranNo
                    !dDate = rs!dDate
                    !nAmount = rs!nAmount
                    !cDesc = rs!cDesc
'                    !nApplied = Format(rs!nAmount - (rs!nAmount * rs!nTaxRate), "#,##0.00")
                    !nApplied = rs!nAmount - (rs!nAmount * rs!nTaxRate)
                    !nEWT = Format((rs!nAmount * rs!nTaxRate), "#,##0.00")
                End With
            End If
    End Select
End Sub

Private Sub dtgNonTrade_Click()
    If Mode = AddNewEdit Then dtgName = dtgNonTrade.Name
End Sub

Private Sub dtgNonTrade_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgNonTrade_GotFocus()
    dtgName = dtgNonTrade.Name
End Sub

Private Sub dtgNonTrade_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgNonTrade_KeyPress(KeyAscii As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If rsNonTrade.RecordCount = 0 Then Exit Sub

    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}

    If KeyAscii = 13 Then
        Select Case dtgNonTrade.Col
            Case 0
                sSQL = "select * from PAYABLES where cTranNo = '" & Trim(dtgNonTrade.Columns(0).Text) & "' and cCode = '" & Trim(txtCode) & " 'and cCompanyID = '" & COID & "'"
                
                Set rs = New Recordset
                rs.Open sSQL, cn, adOpenForwardOnly, adLockReadOnly
                If rs.RecordCount = 0 Then
                    dtgNonTrade.Col = 0
                    dtgNonTrade_ButtonClick 0
                Else
                      With rsNonTrade
                        !cPayableID = rs!cTranNo
                        !dDate = rs!dDate
                        !nAmount = rs!nAmount
                        !nApplied = Format(rs!nAmount - (rs!nAmount * rs!nTaxRate), "#,##0.00")
                        !nEWT = Format((rs!nAmount * rs!nTaxRate), "#,##0.00")
                        End With
                End If
                Set rs = Nothing
            End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
    End If
End Sub

Private Sub dtgNonTrade_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgNonTrade.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

'Set Your Object
Private Sub Form_Load()

    Set FrmName = Me
    FormSetup

    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'AP04'")
    
    Set FrmName = Me
    Set rsHeader = New ADODB.Recordset
    Set rsTrade = New ADODB.Recordset
    Set rsOPEX = New ADODB.Recordset
    Set rsNonTrade = New ADODB.Recordset
    Set rsTPC = New ADODB.Recordset
    
    
    FormLocking True
    FormSearch True
    SearchObj True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    
    'System generated number
'    lSystemGenerated = GetValueFrTable("lBit", "SYSTEM_OPTION", "cCode = 'OTHERS_AUTOTRANNO_RFP' ")
    
    Set FrmName = Me
        Mode = Find
    txtTranNo.Locked = False

End Sub

'Activate your Toolbar Mode
Private Sub Form_Activate()
    TBBitReload
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    
       
    
    
    
    
    Set oPrint = Nothing
    Set rsHeader = Nothing
    Set rsTrade = Nothing
    Set rsOPEX = Nothing
    Set rsNonTrade = Nothing
    Set rsTPC = Nothing
    
    Set frmAPRFP = Nothing

    lCloseWindow = True
    
'    'oForm(Me.Tag).Mode = 1
'    'oForm(Me.Tag).Tag = Me.Tag
End Sub

Public Sub TBNew()
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    txtTranNo.BackColor = &HE0FFFF
    Mode = AddNewEdit
    
    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connHeader
        OpenNewConnection connTrade
        OpenNewConnection connOPEX
        OpenNewConnection connNonTrade
        OpenNewConnection connTPC
        
        OpenRecordsetWithCN rsTPC, "*", "RFP_TPC", connTPC, "WHERE 1 = 0"
        OpenRecordsetWithCN rsTrade, "*", "RFP_TRADE", connTrade, "WHERE 1 = 0"
        OpenRecordsetWithCN rsNonTrade, "*", "RFP_NONTRADE", connNonTrade, "WHERE 1 = 0"
        OpenRecordsetWithCN rsOPEX, "*", "RFP_OPEX", connOPEX, "WHERE 1 = 0"
        OpenRecordsetWithCN rsHeader, "*", "RFP", connHeader, "WHERE 1 = 0"
        
        SetDataSource
        SetDataField
    Else
        vBM = rsHeader.Bookmark
    End If

    rsHeader.AddNew
    rsHeader!cCompanyID = COID
    rsHeader!dDate = Date
    rsHeader!cType = "Trade"
    txtPCCode.Text = "407-00"
    'rsHeader!cPCCode = "407-00"
    
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    SSTab1.ActiveTab = 0
    txtTranNo.SetFocus
    
    lSystemGenerated = GetValueFrTable("lBit", "SYSTEM_OPTION", "cCode = 'AUTO_NUMBER_RFP' ")
    If lSystemGenerated Then rsHeader!cTranNo = GetAutoCtrlNo(rsHeader, "AUTO_NUMBER_RFP", "RFP", "cTranNo")
    'If lSystemGenerated Then GetCtrlNo
End Sub

Public Sub TBUndoAll()
On Error GoTo ErrorHandler

    Mode = Normal
    
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    
    rsHeader.CancelBatch adAffectAll
    rsTrade.CancelBatch adAffectAll
    rsOPEX.CancelBatch adAffectAll
    rsNonTrade.CancelBatch adAffectAll
    rsTPC.CancelBatch adAffectAll
    
    UnbindControls
    
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    
    Set FrmName = Me
    FormLocking True
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
    Else
        RSZero
        Mode = Find
    End If

    sbRS.Panels(2) = ""
    
    SetDataSource
    SetDataField

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoAll
    End If
    
End Sub

'Undo changes on the current record
Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler

    GetChild
    If rsHeader.Status = adRecNew Then
        rsTrade.CancelBatch adAffectAll
        rsOPEX.CancelBatch adAffectAll
        rsNonTrade.CancelBatch adAffectAll
        rsTPC.CancelBatch adAffectAll
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
        rsTrade.CancelBatch adAffectAll
        rsOPEX.CancelBatch adAffectAll
        rsNonTrade.CancelBatch adAffectAll
        rsTPC.CancelBatch adAffectAll
    End If
   
    If rsHeader.RecordCount = 0 Then RSZero
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoCurrent
    End If
End Sub

Public Sub TBSave()
Dim OKUpdate As Boolean
Dim lNew As Boolean
On Error GoTo ErrHandler

    'Audit Trail
    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True
    
    If Not MandatoryOK Then Exit Sub
    
'    If rsHeader.Status = adRecNew Then
'        If lSystemGenerated Then
'            If Not CheckCtrlNo Then Exit Sub
'        End If
'        lNew = True
'    End If

    'System generated number
    If rsHeader.Status = adRecNew Then
    
        If lSystemGenerated Then
            If ChkCtrlNo(rsHeader, "AUTO_NUMBER_RFP", "RFP", "cTranNo", rsHeader!cTranNo) <> rsHeader!cTranNo Then
                GetChild
                
                rsHeader!cTranNo = strNo
                
                If rsTrade.RecordCount <> 0 Then rsTrade.MoveFirst
                Do Until rsTrade.EOF
                    rsTrade!cTranNo = strNo
                    rsTrade.MoveNext
                Loop
                
                If rsOPEX.RecordCount <> 0 Then rsOPEX.MoveFirst
                Do Until rsOPEX.EOF
                    rsOPEX!cTranNo = strNo
                    rsOPEX.MoveNext
                Loop
                
                If rsNonTrade.RecordCount <> 0 Then rsNonTrade.MoveFirst
                Do Until rsNonTrade.EOF
                    rsNonTrade!cTranNo = strNo
                    rsNonTrade.MoveNext
                Loop
                
                If rsTPC.RecordCount <> 0 Then rsTPC.MoveFirst
                Do Until rsTPC.EOF
                    rsTPC!cTranNo = strNo
                    rsTPC.MoveNext
                Loop
                
                GetChild
            End If
        End If
    End If
    '-------
    OKUpdate = False
    cn.BeginTrans
    connHeader.BeginTrans
    connTrade.BeginTrans
    connOPEX.BeginTrans
    connNonTrade.BeginTrans
    connTPC.BeginTrans
    
    rsHeader.UpdateBatch adAffectAll
    rsTrade.UpdateBatch adAffectAll
    rsOPEX.UpdateBatch adAffectAll
    rsNonTrade.UpdateBatch adAffectAll
    rsTPC.UpdateBatch adAffectAll
    
    cn.CommitTrans
    connHeader.CommitTrans
    connTrade.CommitTrans
    connOPEX.CommitTrans
    connNonTrade.CommitTrans
    connTPC.CommitTrans
    OKUpdate = True
    
    Set FrmName = Me
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
    Mode = Normal
    
    'Audit trail
    UpdateLogFile "Request for Payment", Trim(txtTranNo), IIf(lBoolean, "Inserted", "Updated")
    
    MsgBox "Record/s successfully saved.", vbInformation, "ComUnion"
    sbRS.Panels(2) = ""
    
'    'System generated so no
'    If lNew = True Then
'        If lSystemGenerated = True Then UpdateCtrlNo
'    End If
'    '----------------------
    'update system generated number
    If lBoolean Then
        If lSystemGenerated And strNo = rsHeader!cTranNo Then UpdateControlNo strNo, rsHeader!cTranNo, "AUTO_NUMBER_RFP"
    End If
    '----------------------

ErrHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connHeader.RollbackTrans
        connTrade.RollbackTrans
        connOPEX.RollbackTrans
        connNonTrade.RollbackTrans
        connTPC.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, "ComUnion"
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        rsTrade.Requery
        rsOPEX.Requery
        rsNonTrade.Requery
        rsTPC.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else
            RSZero
        End If
    End If
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, "ComUnion"
        cn.RollbackTrans
        connHeader.RollbackTrans
        connTrade.RollbackTrans
        connOPEX.RollbackTrans
        connNonTrade.RollbackTrans
        connTPC.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name 'Error log
    End If
End Sub

Public Sub TBEdit()
    
    Mode = AddNewEdit
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    txtTranNo.Locked = True
    txtCode.Locked = True
    'txtname.locked = True
    txtName.Enabled = True
    cboType.Enabled = False
    cmdCode.Enabled = False
    
    SSTab1.ActiveTab = 0
    dtpDate.SetFocus
    vBM = rsHeader.Bookmark
    
    
End Sub

Public Sub TBDelete()
On Error GoTo ErrorHandler

    sID = Trim(txtTranNo)
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    
    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, "ComUnion") = vbNo Then Exit Sub
    
    GetChild
    If rsTrade.RecordCount <> 0 Then
        rsTrade.MoveFirst
        Do Until rsTrade.RecordCount = 0
            rsTrade.Delete adAffectCurrent
            If rsTrade.RecordCount <> 0 Then rsTrade.MoveFirst
        Loop
    End If
    
    If rsOPEX.RecordCount <> 0 Then
        rsOPEX.MoveFirst
        Do Until rsOPEX.RecordCount = 0
            rsOPEX.Delete adAffectCurrent
            If rsOPEX.RecordCount <> 0 Then rsOPEX.MoveFirst
        Loop
    End If
    
    If rsNonTrade.RecordCount <> 0 Then
        rsNonTrade.MoveFirst
        Do Until rsNonTrade.RecordCount = 0
            rsNonTrade.Delete adAffectCurrent
            If rsNonTrade.RecordCount <> 0 Then rsNonTrade.MoveFirst
        Loop
    End If
    
    If rsTPC.RecordCount <> 0 Then
        rsTPC.MoveFirst
        Do Until rsTPC.RecordCount = 0
            rsTPC.Delete adAffectCurrent
            If rsTPC.RecordCount <> 0 Then rsTPC.MoveFirst
        Loop
    End If
        
    'Audit trail
    UpdateLogFile "Request for Payment", Trim(txtTranNo), "Deleted"

    rsHeader.Delete adAffectCurrent
    
    rsTrade.UpdateBatch adAffectAll
    rsOPEX.UpdateBatch adAffectAll
    rsNonTrade.UpdateBatch adAffectAll
    rsTPC.UpdateBatch adAffectAll
    rsHeader.UpdateBatch adAffectAll
    
    TBPrevRec

    Mode = Normal

    If rsHeader.RecordCount = 0 Then
        RSZero
    End If
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        cn.Execute "DELETE RFP_OPEX WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE RFP_TRADE WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE RFP_NONTRADE WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE RFP_TPC WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE RFP WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
    End If
End Sub

'Search using the frmITGSearch
Public Sub TBFind()
    Mode = Normal
    txtTranNo.Locked = True
    frmITGSearch.Show 'vbModal
End Sub

Public Sub TBFindPrimary()
Dim sTemp As String
If Mode = Find Then
    FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."
            
    OpenNewConnection connHeader
    OpenNewConnection connTrade
    OpenNewConnection connOPEX
    OpenNewConnection connNonTrade
    OpenNewConnection connTPC
    
    Set rsHeader = Nothing
    Set rsTrade = Nothing
    Set rsOPEX = Nothing
    Set rsNonTrade = Nothing
    Set rsTPC = Nothing
    
    Set rsHeader = New ADODB.Recordset
    Set rsTrade = New ADODB.Recordset
    Set rsOPEX = New ADODB.Recordset
    Set rsNonTrade = New ADODB.Recordset
    Set rsTPC = New ADODB.Recordset
        
    sTemp = Trim$(GetSearchString)
    If sTemp = "ERROR" Then
        MsgBox "Only Allows A - Z, 0 - 9, '.', ',' and %(wildcard)", vbExclamation, ""
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
        txtTranNo.Locked = False
        txtTranNo.SetFocus
        Exit Sub
    End If
    
    OpenRecordsetWithCN rsHeader, "*", "RFP", connHeader, IIf(sTemp = "", "", " WHERE " & sTemp)
    'OpenRecordsetWithCN rsTrade, "*", "RFP_TRADE", connTrade
    'OpenRecordsetWithCN rsNonTrade, "*", "RFP_NONTRADE", connNonTrade
    'OpenRecordsetWithCN rsTPC, "*", "RFP_TPC", connTPC
    'OpenRecordsetWithCN rsOPEX, "*", "RFP_OPEX", connOPEX
              
    OpenRecordsetWithCN rsTrade, "*", "RFP_TRADE", connTrade, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM RFP WHERE " & sTemp & ")")
    OpenRecordsetWithCN rsNonTrade, "*", "RFP_NONTRADE", connNonTrade, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM RFP WHERE " & sTemp & ")")
    OpenRecordsetWithCN rsTPC, "*", "RFP_TPC", connTPC, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM RFP WHERE " & sTemp & ")")
    OpenRecordsetWithCN rsOPEX, "*", "RFP_OPEX", connOPEX, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM RFP WHERE " & sTemp & ")")
        
    Set FrmName = Me
    FormLocking True
    
    If rsHeader.RecordCount = 0 Then
        FormWaitHide
        MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
        RSZero
        FormSearch True
        SearchObj True
        Mode = Find
        Exit Sub
    End If
    SetDataSource
    SetDataField
    
    rsHeader!cPCCode = GetValueFrTable("cPCCode", "RFP", "cTranNo = '" & Trim(txtTranNo.Text) & "'")
    txtTranNo.BackColor = &HE0FFFF
    Mode = Normal
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
    
    FormWaitHide
Else
    RSZero
    FormSearch True
    
    SearchObj True
    Mode = Find
   
End If

End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
End Sub

Public Sub TBCloseWindow()
    Unload Me
End Sub

'Move first
Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader
    
End Sub

'Move previuos
Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader

End Sub

'Move next
Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader
    
End Sub

'Move last
Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader

End Sub

Public Sub TBNewLine()

    If rsHeader!cTranNo = "" Then Exit Sub
    
    If dtgName = "dtgTrade" Then
        rsTrade.AddNew
        rsTrade!cCompanyID = COID
        rsTrade!cTranNo = Trim(rsHeader!cTranNo)
        rsTrade!dDate = rsTrade!dDate
        GetChild
        If rsTrade.RecordCount <> 0 Then rsTrade.MoveLast
        dtgTrade.Col = 0
        dtgTrade.Columns(0).Value = ""
        dtgTrade.SetFocus
    ElseIf dtgName = "dtgOpex" Then
        rsOPEX.AddNew
        rsOPEX!cCompanyID = COID
        rsOPEX!cTranNo = Trim(rsHeader!cTranNo)
        GetChild
        If rsOPEX.RecordCount <> 0 Then rsOPEX.MoveLast
        dtgOPEX.Col = 0
        dtgOPEX.Columns(0).Value = ""
        dtgOPEX.SetFocus
    ElseIf dtgName = "dtgNonTrade" Then
        rsNonTrade.AddNew
        rsNonTrade!cCompanyID = COID
        rsNonTrade!cTranNo = Trim(rsHeader!cTranNo)
        rsNonTrade!dDate = rsNonTrade!dDate
        rsNonTrade!nAmount = 0
        rsNonTrade!nApplied = 0
        GetChild
        If rsNonTrade.RecordCount <> 0 Then rsNonTrade.MoveLast
        dtgNonTrade.Col = 0
        dtgNonTrade.SetFocus
    ElseIf dtgName = "dtgTPC" Then
        rsTPC.AddNew
        rsTPC!cCompanyID = COID
        rsTPC!cTranNo = Trim(rsHeader!cTranNo)
        rsTPC!dDate = rsTPC!dDate
        rsTPC!nAmount = 0
        rsTPC!nApplied = 0
        GetChild
        If rsTPC.RecordCount <> 0 Then rsTPC.MoveLast
        dtgTPC.Col = 0
        dtgTPC.SetFocus
    End If
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
End Sub

Public Sub TBDeleteLine()
On Error GoTo ErrorHandler

    If dtgName = "dtgTrade" Then
        If rsTrade.RecordCount = 0 Then Exit Sub
        vBookMark = dtgTrade.Bookmark
        GetChild
        dtgTrade.Bookmark = vBookMark
        rsTrade.Delete adAffectCurrent
    ElseIf dtgName = "dtgOpex" Then
        If rsOPEX.RecordCount = 0 Then Exit Sub
        vBookMark = dtgOPEX.Bookmark
        GetChild
        dtgOPEX.Bookmark = vBookMark
        rsOPEX.Delete adAffectCurrent
    ElseIf dtgName = "dtgNonTrade" Then
        If rsNonTrade.RecordCount = 0 Then Exit Sub
        vBookMark = dtgNonTrade.Bookmark
        GetChild
        dtgNonTrade.Bookmark = vBookMark
        rsNonTrade.Delete adAffectCurrent
    ElseIf dtgName = "dtgTPC" Then
        If rsTPC.RecordCount = 0 Then Exit Sub
        vBookMark = dtgTPC.Bookmark
        GetChild
        dtgTPC.Bookmark = vBookMark
        rsTPC.Delete adAffectCurrent
    End If
    
    GetChild

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

'Undo All
Public Sub TBUndoLineAll()
On Error GoTo ErrorHandler

    MsgBox "Unavailable on " & Me.Name

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Undo current line
Public Sub TBUndoLineCurrent()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Post current record
Public Sub TBPostRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBCancelRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub
Public Sub TBPrintRecord()
    cModule = "Request_for_Payment"
    oPrint.PrintReceipt Trim(txtTranNo)
End Sub

'Sets the data source of the controls
Sub SetDataSource()
    Set FrmName = Me
    BindControls rsHeader
    Set dtgList.DataSource = rsHeader
    Set dtgTrade.DataSource = rsTrade
    Set dtgOPEX.DataSource = rsOPEX
    Set dtgNonTrade.DataSource = rsNonTrade
    Set dtgTPC.DataSource = rsTPC
   
End Sub

Public Sub SetDataField()
    With rsHeader
        txtTranNo.DataField = !cTranNo
        dtpDate.DataField = !dDate
        txtCode.DataField = !cCode
        txtName.DataField = !cName
        txtPayfor.DataField = !cPayfor
        dtpDateNeeded.DataField = !dDateNeeded
        dtpDatedCheck.DataField = !dDatedCheck
        txtType.DataField = !cType
       ' ITGcRemarks.DataField = !cRemarks
        txtRemarks.DataField = "cRemarks"
        txtPCCode.DataField = !cPCCode
    End With
End Sub

Private Sub dtgTPC_ButtonClick(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 3
            If lPickListActive Then Exit Sub
            frmITGPickList.mType = SalesInvoice
            frmITGPickList.Show vbModal
            If Not frmITGPickList.mName = "" Then
                dtgTPC.Columns(3).Text = frmITGPickList.mName
            End If
    End Select
    
End Sub

Private Sub dtgTPC_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgTPC_GotFocus()
    dtgName = "dtgTPC"
End Sub

Private Sub dtgTPC_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgTPC_KeyPress(KeyAscii As Integer)
'On Error Resume Next
'    If KeyAscii = 13 Then
'        If dtgTPC.Columns(3).Text = "" Then
'            CallPickList
'        ElseIf dtgTPC.Col = 6 Then
'            TBNewLine
'        Else
'            SendKeys "{TAB}"
'        End If
'    End If
    If Mode <> AddNewEdit Then Exit Sub
    If rsTPC.RecordCount = 0 Then Exit Sub

    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}

    If KeyAscii = 13 Then
        Select Case dtgTPC.Col
            Case 3
                dtgTPC_ButtonClick (3) 'use button click
            Case 6
                TBNewLine
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
    End If

End Sub

Private Sub dtgTPC_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = "dtgTPC"
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub


Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler

    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        'Status bar setup
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount

        If rsHeader.Status <> adRecNew Then
            txtTranNo.Locked = True
        Else
            txtTranNo.Locked = False
        End If
        'added 08-30-2007
        If Mode = AddNewEdit Then
            txtName.Enabled = True
         End If
        
        
        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        
            
        
        Else
            sbRS.Panels(2) = ""
        End If
        
        If Mode <> AddNewEdit Then
            If IsNull(rsHeader!dDateNeeded) Then
                Set dtpDateNeeded.DataSource = Nothing
                dtpDateNeeded.Text = "__/__/____"
            Else: Set dtpDateNeeded.DataSource = rsHeader
            End If
                    
        End If
        'added code
            If Mode <> AddNewEdit Then
                If IsNull(rsHeader!cRemarks) Then
                    Set txtRemarks.DataSource = Nothing
                    dtpDateNeeded.Text = ""
                Else: Set txtRemarks.DataSource = rsHeader
                End If
            End If
        
        GetChild
        
        If rsHeader!lCancelled = True Then
            sbRS.Panels(5) = "CANCELLED"
        Else
            sbRS.Panels(5) = ""
        End If
    Else
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtTranNo.Locked = False
    End If

    If Mode = AddNewEdit Then
        dtgTrade.Refresh
        dtgOPEX.Refresh
        dtgNonTrade.Refresh
        dtgTPC.Refresh
    End If

ErrorHandler:
    'Err.Number -2147217885
    'Description - Row handle referred to a deleted row or a row marked for deletion.
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Check if all mandatory fields are complete
Function MandatoryOK() As Boolean

    MandatoryOK = True

    If Trim(txtTranNo) = "" Then
        MandatoryOK = False
        MsgBox "Field 'RFP No.' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        txtTranNo.SetFocus
        Exit Function
    End If
    
'    If rsHeader.Status = adRecNew And lSystemGenerated = False Then
'        If IDExisting(rsHeader, "cTranNo", "RFP", Trim(rsHeader!cTranNo)) Then
'            MandatoryOK = False
'            MsgBox "RFP No. already exist.", vbInformation, "ComUnion"
'            txtTranNo.SetFocus
'            Exit Function
'        End If
'    End If
    If rsHeader.Status = adRecNew And lSystemGenerated = False Then
        If IDExisting(rsHeader, "cTranNo", "RFP", Trim(rsHeader!cTranNo)) Then
            MandatoryOK = False
            MsgBox "RFP Transaction No. already exist.", vbInformation, "ComUnion"
            txtTranNo.SetFocus
            Exit Function
        End If
    End If

    'Required fields
    If Trim(dtpDate.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Date' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        dtpDate.SetFocus
        Exit Function
    ElseIf Trim(txtType) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Type' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        cboType.SetFocus
        Exit Function
    ElseIf Trim(txtCode) = "" And cboType = "Non - Trade" Then
       ' MandatoryOK = False
        ' MsgBox "Field 'Name' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        'txtCode.SetFocus
       ' Exit Function
    End If
    
    If IsDate(dtpDateNeeded.Text) Then
        rsHeader!dDateNeeded = dtpDateNeeded.Text
    End If
    GetChild
    
'    added 08-30-2007
'    If cboType = "Non - Trade" And txtCode.Text = "" Then
'        MandatoryOK = True
'    End If
    
    'Transaction without details
    If cboType = "Trade" Then
        If rsTrade.RecordCount = 0 Then
            MandatoryOK = False
            MsgBox "Cannot save transaction without details.", vbInformation, "ComUnion"
            dtgTrade.SetFocus
            Exit Function
        End If
    End If
    
'    If cboType = "Non - Trade" Then
'        If rsNonTrade.RecordCount = 0 Then
'            MandatoryOK = False
'            MsgBox "Cannot save transaction without details.", vbInformation, "ComUnion"
'            dtgTrade.SetFocus
'            Exit Function
'        End If
'    End If
    
    
    If rsTrade.RecordCount <> 0 Then rsTrade.MoveFirst
    Do Until rsTrade.EOF
        If rsTrade.Status = (adRecNew) Or rsTrade.Status = (adRecModified) Then
            If IsNull(rsTrade!cTranNo) Then
                rsTrade.Delete
            ElseIf Trim(rsTrade!cTranNo) = "" Then
                rsTrade.Delete
            Else
                rsTrade.MoveNext
            End If
        Else
            rsTrade.MoveNext
        End If
    Loop

    GetChild
    
    If rsOPEX.RecordCount <> 0 Then rsOPEX.MoveFirst
    Do Until rsOPEX.EOF
        If rsOPEX.Status = (adRecNew) Or rsOPEX.Status = (adRecModified) Then
            If IsNull(rsOPEX!cTranNo) Or IsNull(rsOPEX!cAcctNo) Then
                rsOPEX.Delete
            ElseIf Trim(rsOPEX!cTranNo) = "" Or Trim(rsOPEX!cAcctNo) = "" Then
                rsOPEX.Delete
            Else
                rsOPEX.MoveNext
            End If
        Else
            rsOPEX.MoveNext
        End If
    Loop
    
    GetChild
    
        If rsNonTrade.RecordCount <> 0 Then rsNonTrade.MoveFirst
    Do Until rsNonTrade.EOF
        If rsNonTrade.Status = (adRecNew) Or rsNonTrade.Status = (adRecModified) Then
            If IsNull(rsNonTrade!cTranNo) Then
                rsNonTrade.Delete
            ElseIf Trim(rsNonTrade!cTranNo) = "" Then
                rsNonTrade.Delete
            Else
                rsNonTrade.MoveNext
            End If
        Else
            rsNonTrade.MoveNext
        End If
    Loop
    
    GetChild
    
    If rsTPC.RecordCount <> 0 Then rsTPC.MoveFirst
    Do Until rsTPC.EOF
        If rsTPC.Status = (adRecNew) Or rsTPC.Status = (adRecModified) Then
            If IsNull(rsTPC!cTranNo) Then
                rsTPC.Delete
            ElseIf Trim(rsTPC!cTranNo) = "" Then
                rsTPC.Delete
            Else
                rsTPC.MoveNext
            End If
        Else
            rsTPC.MoveNext
        End If
    Loop
    
    
'    If rsTrade.RecordCount < 1 Then
'        MsgBox "Cannot save transaction without details.", vbExclamation, "ComUnion"
'        MandatoryOK = False
'        Exit Function
'    End If
    
End Function

'Filter detail recordset to header's primary
Private Sub GetChild()
    rsTrade.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
    rsOPEX.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
    rsNonTrade.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
    rsTPC.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
End Sub

'Sets the form if record number is zero
Private Sub RSZero()
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    sbRS.Panels(4) = ""
    sbRS.Panels(5) = ""
    
    Set dtgTrade.DataSource = Nothing
    Set dtgNonTrade.DataSource = Nothing
    Set dtgOPEX.DataSource = Nothing
    Set dtgTPC.DataSource = Nothing
    
    dtgTrade.Refresh
    dtgNonTrade.Refresh
    dtgOPEX.Refresh
    dtgTPC.Refresh
        
    Set FrmName = Me
    UnbindControls
    TextClearing
    FormLocking True
    If rsHeader.State = adStateOpen Then rsHeader.Close
    If rsTrade.State = adStateOpen Then rsTrade.Close
    If rsOPEX.State = adStateOpen Then rsOPEX.Close
    If rsNonTrade.State = adStateOpen Then rsNonTrade.Close
    If rsTPC.State = adStateOpen Then rsTPC.Close
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    
    txtTranNo.Locked = False
    txtTranNo.SetFocus
    
    Mode = Find
    
End Sub

Sub SearchObj(lEnable As Boolean)
    cboType.Enabled = lEnable
    dtpDate.Enabled = lEnable
    cmdCode.Enabled = lEnable
End Sub

Public Sub AddDetailsFromList(InvNo As String, InvDate As String, InvBalance As Double)
    
    If dtgName = dtgTrade.Name Then
        With rsTrade
            !cInvNo = Trim(InvNo)
            !dDate = Trim(InvDate)
            !nAmount = InvBalance
            !nApplied = InvBalance
            dtgTrade.Col = 3
            dtgTrade.Columns(3).Value = !nApplied
        End With
    End If
    
End Sub
'Change Transaction Number
Sub ChangeTranNo(strTranNo As String)
    GetChild
    
    rsHeader!cTranNo = strTranNo
        If rsTrade.RecordCount <> 0 Then rsTrade.MoveFirst
        Do Until rsTrade.EOF
            rsTrade!cTranNo = strTranNo
            rsTrade.MoveNext
        Loop
        If rsOPEX.RecordCount <> 0 Then rsOPEX.MoveFirst
        Do Until rsOPEX.EOF
            rsOPEX!cTranNo = strTranNo
            rsOPEX.MoveNext
        Loop
        If rsNonTrade.RecordCount <> 0 Then rsNonTrade.MoveFirst
        Do Until rsNonTrade.EOF
            rsNonTrade!cTranNo = strTranNo
            rsNonTrade.MoveNext
        Loop
        
        If rsTPC.RecordCount <> 0 Then rsTPC.MoveFirst
        Do Until rsTPC.EOF
            rsTPC!cTranNo = strTranNo
            rsTPC.MoveNext
        Loop
    GetChild
End Sub
Private Sub dtgOpex_AfterColUpdate(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 1
            If GetValueFrTable("cAcctNo", "ACCOUNT", "cAcctNo = '" & Trim(dtgOPEX.Columns(1).Text) & "'") <> "" Then
                dtgOPEX.Columns(2).Value = GetValueFrTable("cTitle", "ACCOUNT", "cAcctNo = '" & Trim(dtgOPEX.Columns(1).Text) & "'")
                dtgOPEX.Columns(3).Value = "" 'rsDetail!cDesc
            End If
    End Select
End Sub

Private Sub dtgOPEX_ButtonClick(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
                Call MoveCombo(cboRFP, dtgOPEX, dtgOPEX.Columns(0))
                ComboLoadValue cboRFP, Trim(dtgOPEX.Columns(0).Text)
        Case 1
            If lPickListActive Then Exit Sub
            sFilterString = Trim(dtgOPEX.Columns(1).Text)
            frmITGPicker.zType = QAccounts
            frmITGPicker.Show vbModal
            If Trim(frmITGPicker.zCode) = "" Then Exit Sub
            dtgOPEX.Columns(1).Value = frmITGPicker.zCode & ""
            dtgOPEX.Columns(2).Value = frmITGPicker.zName & ""
            dtgOPEX.Col = 3
            dtgOPEX.Columns(3).Value = rsOPEX!cDesc
    End Select
End Sub

Private Sub dtgOPEX_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgOPEX_GotFocus()
    dtgName = dtgOPEX.Name
End Sub

Private Sub dtgOPEX_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgOPEX_KeyPress(KeyAscii As Integer)

    If Mode <> AddNewEdit Then Exit Sub
    If rsOPEX.RecordCount = 0 Then Exit Sub
    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}
    
    If KeyAscii = 13 Then
        Select Case dtgOPEX.Col
            Case 0
                If Not cboRFP.Visible Then dtgOPEX_ButtonClick (0)
            Case 1
                If GetValueFrTable("cAcctNo", "ACCOUNT", "cAcctNo = '" & Trim(dtgOPEX.Columns(1).Text) & "'") = "" Then
                    dtgOPEX_ButtonClick (1)
                    Exit Sub
                End If
                SendKeys "{Tab}"
                SendKeys "{Tab}"
            Case 5
                TBNewLine
                dtgOPEX.Col = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii)))
    End If
End Sub

Private Sub dtgOPEX_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgOPEX.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub dtgTrade_KeyPress(KeyAscii As Integer)

    If Mode <> AddNewEdit Then Exit Sub
    If rsTrade.RecordCount = 0 Then Exit Sub

    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}

    If KeyAscii = 13 Then
        Select Case dtgTrade.Col
            Case 0
                sSQL = "SELECT A.cWRRNo, (B.nGross - B.nPaid - B.nReturns - B.nCredit + B.nDebit) AS nBalance FROM WRR A " & _
                        "INNER JOIN V_WRRBalanceInquiry B ON A.cWRRNo = B.cWRRNo " & _
                        "WHERE A.cWRRNo = '" & Trim(dtgTrade.Columns(0).Text) & "' " & _
                        "AND A.cCompanyID = '" & COID & "' " & _
                        "AND ((B.nGross - B.nPaid - B.nReturns - B.nCredit + B.nDebit) <> 0)"
                Set rs = New Recordset
                rs.Open sSQL, cn, adOpenForwardOnly, adLockReadOnly
                If rs.RecordCount = 0 Then
                    dtgTrade.Col = 0
                    dtgTrade_ButtonClick 0
                Else
                    rsTrade!dDate = GetValueFrTable("dDate", "WRR", "cWRRNo = '" & Trim(dtgTrade.Columns(0).Text) & "'")
                    rsTrade!nAmount = rs!nBalance
                    dtgTrade.Col = 3
                    dtgTrade.Columns(3).Value = rs!nBalance
                    rsTrade!cInvNo = rs!cWRRNo
                End If
                Set rs = Nothing
            Case 3
                TBNewLine
                dtgTrade.LeftCol = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
    End If

End Sub

Private Sub dtgTrade_ButtonClick(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            RepName = Trim(txtCode)
            frmARCollectionList.mSIPick = ToRFPPI
            frmARCollectionList.Show vbModal
    End Select
End Sub

Private Sub dtgTrade_Click()
    If Mode = AddNewEdit Then dtgName = dtgTrade.Name
End Sub

Private Sub dtgTrade_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgTrade_GotFocus()
    dtgName = dtgTrade.Name
End Sub

Private Sub dtgTrade_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgTrade_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgTrade.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub txtCode_Change()
    txtName = ""
    If Trim(cboType) = "Trade" Then
        txtName = GetValueFrTable("cName", "CLIENT_SUPPLIER", "cCode = '" & Trim(txtCode) & "'")
    Else
      'added 08-31-2007
      '  txtName = GetValueFrTable("cName", "CLIENT_SUPPLIER_NT", "cCode = '" & Trim(txtCode) & "'")
    End If
End Sub

Private Sub txtCode_LostFocus()
If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtName) = "" And Trim(txtCode) <> "" Then cmdCode_Click
End Sub

Private Sub txtTranNo_LostFocus()
'Does Code Already Exist
    If Mode = AddNewEdit Then
        If Trim(txtTranNo) = "" Then
            MsgBox "Empty primary input.", vbInformation, "ComUnion"
            If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
            txtTranNo.SetFocus
        Else
            If rsHeader.Status <> adRecNew Then Exit Sub
            txtTranNo = Trim(txtTranNo)
            If IDExisting(rsHeader, "cTranNo", "RFP", Trim(rsHeader!cTranNo)) Then
                MsgBox "RFP No. already exist.", vbInformation, "ComUnion"
                If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
                txtTranNo.SetFocus
            End If
        End If
    End If
End Sub

Private Sub dtpDatedCheck_LostFocus()
'On Error Resume Next
'    If Trim(cboType) = "Non-Trade" And rsOPEX.RecordCount = 0 Then
'        dtgName = dtgOpex.Name
'        TBNewLine
'        dtgOpex.Col = 0
'    ElseIf Trim(cboType) = "Trade" And rsTrade.RecordCount = 0 Then
'        dtgName = dtgTrade.Name
'        TBNewLine
'        dtgTrade_ButtonClick (0)
'    End If
End Sub

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab1.TabEnabled(1) = False
    Else
        SSTab1.TabEnabled(1) = True
    End If
End Sub

''Check system generated number before saving
'Function CheckCtrlNo() As Boolean
'
'Dim lCtrlNoOK As Boolean
'Dim strNewNo As String
'Dim strNewRFPNo As String
'Dim sTrap
'
''On Error GoTo TheSource
'
'    CheckCtrlNo = False
'
'    If IDExisting(rsHeader, "cTranNo", "RFP", rsHeader!cTranNo) Then
'        sTrap = Left(txtTranNo, 6) & (Format(Right(txtTranNo, 4) - 1, "0000"))
'
'        strNewNo = Trim(GetValueFrTable("cValue", "PARAMETER_USER", "cType = 'RFP' "))
'
'        Do Until lCtrlNoOK
'            If IDExisting(rsHeader, "cTranNo", "RFP", Left(strNewNo, 6) + Format(CStr((CInt(Right(strNewNo, 4)) + 1)), "0000")) Then
'                strNewNo = Left(strNewNo, 6) + Format(CStr((CInt(Right(strNewNo, 4)) + 1)), "0000")
'            Else
'                lCtrlNoOK = True
'            End If
'        Loop
'
'        If Mid(strNewNo, 5, 2) <> Format(Date, "yy") Then
'            strNewRFPNo = Format(1, "0000")
'            strNewNo = "RFP-" + Format(Date, "yy") + "0000"
'        Else
'            strNewRFPNo = Format(Right(strNewNo, 4) + 1, "0000")
'        End If
'        strNewRFPNo = "RFP-" + Format(Date, "yy") + Trim(strNewRFPNo)
'
'        GetChild
'
'        rsHeader!cTranNo = strNewRFPNo
'        If rsTrade.RecordCount <> 0 Then rsTrade.MoveFirst
'        Do Until rsTrade.EOF
'            rsTrade!cTranNo = strNewRFPNo
'            rsTrade.MoveNext
'        Loop
'
'        If rsOPEX.RecordCount <> 0 Then rsOPEX.MoveFirst
'        Do Until rsOPEX.EOF
'            rsOPEX!cTranNo = strNewRFPNo
'            rsOPEX.MoveNext
'        Loop
'
'        If rsNonTrade.RecordCount <> 0 Then rsNonTrade.MoveFirst
'        Do Until rsNonTrade.EOF
'            rsNonTrade!cTranNo = strNewRFPNo
'            rsNonTrade.MoveNext
'        Loop
'
'        If rsTPC.RecordCount <> 0 Then rsTPC.MoveFirst
'        Do Until rsTPC.EOF
'            rsTPC!cTranNo = strNewRFPNo
'            rsTPC.MoveNext
'        Loop
'        GetChild
'
'        strNo = strNewNo
'    End If
'
'    CheckCtrlNo = True
'
''TheSource:
''    If Not CheckCtrlNo Then
''        If MsgBox("Record cannot be updated. Transaction number already exists. " & vbCr & _
''                "Current transaction number may have been used by other user/s since last read." & vbCr & _
''                "Do you want to assign another number?", vbYesNo + vbInformation, "ComUnion") = vbYes Then
''            frmChangeTranNo.mType = Change_PRNo
''            frmChangeTranNo.Show vbModal
''        Else
''            MsgBox "Transaction will be undone.", vbInformation, "ComUnion"
''            TBUndoAll
''        End If
''    End If
'End Function
'
'
''System genereted number
'Sub GetCtrlNo()
'Dim lCtrlNoOK As Boolean
'
'    strNo = Trim(GetValueFrTable("cValue", "PARAMETER_USER", "cType = 'RFP' "))
'
'    Do Until lCtrlNoOK
'        If IDExisting(rsHeader, "cTranNo", "RFP", Left(strNo, 6) + Format(CStr((CInt(Right(strNo, 4)) + 1)), "0000")) Then
'            strNo = Left(strNo, 6) + Format(CStr((CInt(Right(strNo, 4)) + 1)), "0000")
'        Else
'            lCtrlNoOK = True
'        End If
'    Loop
'
'    If Mid(strNo, 5, 2) <> Format(Date, "yy") Then
'        txtTranNo = Format(1, "0000")
'        strNo = "RFP-" + Format(Date, "yy") + "0000"
'    Else
'        txtTranNo = Format(Right(strNo, 4) + 1, "0000")
'    End If
'    txtTranNo = "RFP-" + Format(Date, "yy") + Trim(txtTranNo)
'End Sub

Private Function GetSearchString() As String
On Error GoTo ErrorHandler
Dim sWhere As String

    GetSearchString = True

    If Trim$(txtTranNo.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cTranNo LIKE '" & Trim$(txtTranNo.Text) & "%'"
    End If

    If Trim$(txtType.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cType LIKE '" & Trim$(txtType.Text) & "%'"
    End If
    
    If Trim$(dtpDate.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dDate = '" & Trim$(dtpDate.Text) & "'"
    End If
    
    If Trim$(txtCode.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cCode LIKE '" & Trim$(txtCode.Text) & "%'"
    End If
    
    GetSearchString = Trim$(sWhere)

    Exit Function
ErrorHandler:
    GetSearchString = "ERROR"
End Function

'Update system generated number
Sub UpdateCtrlNo()
On Error GoTo TheSource
    If (Left(txtTranNo, 6) & (Format(Right(txtTranNo, 4) - 1, "0000"))) <> (strNo) Then Exit Sub
    sSQL = "UPDATE PARAMETER_USER SET cValue = '" & Trim(txtTranNo) & "' WHERE cType = 'RFP' AND cCompanyID = '" & COID & "'"
    cn.Execute sSQL
TheSource:
    Exit Sub
End Sub

Private Sub txtType_Change()
    If Trim(txtType) <> "" Or txtType <> vbNullString Then
        cboType = Trim(txtType)
    Else
        cboType.ListIndex = -1
    End If
    If Mode = AddNewEdit Then
        txtCode = ""
        If rsHeader!cType = "Trade" Then
            SSTab2.TabEnabled(1) = True
            SSTab2.TabEnabled(2) = False
            If rsNonTrade.RecordCount <> 0 Then rsNonTrade.MoveFirst
            Do Until rsNonTrade.EOF
                rsNonTrade.Delete
                rsNonTrade.MoveNext
            Loop
        Else
            SSTab2.TabEnabled(1) = False
            SSTab2.TabEnabled(2) = True
            Do Until rsNonTrade.EOF
                rsNonTrade.Delete
                rsNonTrade.MoveNext
            Loop
        End If
    End If
    
End Sub

Public Sub ShowTran()
    If Mode = Find Then

    OpenNewConnection connHeader
    OpenNewConnection connTrade
    OpenNewConnection connOPEX
    OpenNewConnection connNonTrade
    OpenNewConnection connTPC
    
    Set rsHeader = Nothing
    Set rsTrade = Nothing
    Set rsOPEX = Nothing
    Set rsNonTrade = Nothing
    Set rsTPC = Nothing
    
    Set rsHeader = New ADODB.Recordset
    Set rsTrade = New ADODB.Recordset
    Set rsOPEX = New ADODB.Recordset
    Set rsNonTrade = New ADODB.Recordset
    Set rsTPC = New ADODB.Recordset

    OpenRecordsetWithCN rsHeader, "*", "RFP", connHeader, "WHERE cTranNo = '" & Trim(txtTranNo) & "'", True
    OpenRecordsetWithCN rsTrade, "*", "RFP_TRADE", connTrade, "WHERE cTranNo = '" & Trim(txtTranNo) & "'", True
    OpenRecordsetWithCN rsNonTrade, "*", "RFP_NONTRADE", connNonTrade, "WHERE cTranNo = '" & Trim(txtTranNo) & "'", True
    OpenRecordsetWithCN rsTPC, "*", "RFP_TPC", connTPC, "WHERE cTranNo = '" & Trim(txtTranNo) & "'", True
    OpenRecordsetWithCN rsOPEX, "*", "RFP_OPEX", connOPEX, "WHERE cTranNo = '" & Trim(txtTranNo) & "'", True
        
        Set FrmName = Me
        FormLocking True

       If rsHeader.RecordCount = 0 Then
            FormWaitHide
            MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
            RSZero
            FormSearch True
            SearchObj True
            Mode = Find
            Exit Sub
        End If
            SetDataSource
            SetDataField
            txtTranNo.BackColor = &HE0FFFF
            Mode = Normal
            BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , True, , , , True, , , True
'            oBar.BitEnabled Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True, True

    End If
End Sub
